package com.tos.second.properties;

import jakarta.annotation.PostConstruct;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "baidu.ai")
@Data
public class BaiduAiProperties {
    private String apiKey;
    private String secretKey;
    private ImageClassify imageClassify = new ImageClassify();
    private LogoDetect logoDetect = new LogoDetect();
    private AccessToken accessToken = new AccessToken();
    private UniversalClassify universalClassify = new UniversalClassify();
    
    @Data
    public static class ImageClassify {
        private String url;
    }
    
    @Data
    public static class LogoDetect {
        private String url;
    }
    
    @Data
    public static class AccessToken {
        private String url;
    }
    
    @Data
    public static class UniversalClassify {
        private String url;
    }
    
    // 提供便捷的getter方法
    public String getImageClassifyUrl() {
        return imageClassify.getUrl();
    }
    
    public String getLogoDetectUrl() {
        return logoDetect.getUrl();
    }
    
    public String getAccessTokenUrl() {
        return accessToken.getUrl();
    }
    
    public String getUniversalClassifyUrl() {
        return universalClassify.getUrl();
    }
    
    @PostConstruct
    public void validateProperties() {
        System.out.println("百度AI配置加载完成:");
        System.out.println("API Key: " + apiKey);
        System.out.println("Secret Key: " + secretKey);
        System.out.println("Image Classify URL: " + imageClassify.getUrl());
        System.out.println("Logo Detect URL: " + logoDetect.getUrl());
        System.out.println("Access Token URL: " + accessToken.getUrl());
        System.out.println("Universal Classify URL: " + universalClassify.getUrl());
    }
}